package org.epidroid.epidroid.news.engine;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.net.nntp.Article;

public class NewsArticle {
	private String _group_title = null;
	
	private String _id = null;
	private String _subject = null;
	private String _date = null;
	private String _from = null;
	private Boolean _is_reply = null;
	private Boolean _read = false;
	
	private String[] _refs = null;
	
	private String _body = null;
	private Boolean _loaded = false;
	private Boolean _loading = false;
	//private Date _date = null;
	private List<NewsArticle> _replies = null;

	public NewsArticle(Article article, String groupTitle) {
		_id = article.getArticleId();
		_subject = article.getSubject();
		_date = article.getDate();
		_from = article.getFrom();
		_group_title = groupTitle;
		_is_reply = article.subjectIsReply();
		
		_refs = article.getReferences();
		
		_replies = new ArrayList<NewsArticle>();
		//_date = new Date(article.getDate());
	}
	
	public NewsArticle(String id, String subject, String date, String from, Boolean isReply, String group_title, Boolean read) {
		_id = id;
		_subject = subject;
		_date = date;
		_from = from;
		_group_title = group_title;
		_is_reply = isReply;
		_read = read;
		
		_replies = new ArrayList<NewsArticle>();
	}

	public void addReply(NewsArticle a) {
		_replies.add(a);
	}

	public List<NewsArticle> getReplies() {
		return _replies;
	}
	
	public Boolean isReply() {
		return _is_reply;
	}
	
	public String[] getReferences() {
		return _refs;
	}
	
	public String getGroupTitle() {
		return _group_title;
	}

	public String getId() {
		return _id;
	}

	public String getSubject() {
		return _subject;
	}

	public String getDate() {
		return _date;
	}
	
	public String getBody() {
		return _body;
	}
	
	public String getFrom() {
		return _from;
	}

	public void setBody(String _body) {
		this._body = _body;
	}

	public Boolean isRead() {
		return _read;
	}
	
	public Boolean isLoaded() {
		return _loaded;
	}

	public void setIsLoaded(Boolean _loaded) {
		this._loaded = _loaded;
	}

	public Boolean isLoading() {
		return _loading;
	}

	public void setIsLoading(Boolean loading) {
		_loading = loading;
	}

}
